#ifndef CRESOURCE_H
#define CRESOURCE_H

#include <string>
#include <stdint.h>


class CResource
{
private:
    // Set copy/assignment ctor/op to private to avoid possible issues

    CResource(const CResource& other);
    CResource& operator=(const CResource& other);

protected:
	std::string	m_FileName;                                         // Filename of resource
	std::string	m_Path;                                             // Path of resource
	std::string	m_PathFileName;                                     // m_Path + m_FileName
	uint32_t m_Handle;                                              // Handle integer (from CResourceManager)
	uint32_t m_RefCount;                                            // Number of references to this resource

public:
    CResource(uint32_t handle, const std::string& fileName, const std::string& path = "./");
    virtual ~CResource();

    // Do not call the increment/decrement functions directly,
    // they will be called from the corresponding resource
    // manager automatically during the Add and Remove functions.

    void IncRef()                                                   { m_RefCount++; }
    void DecRef()                                                   { m_RefCount--; }

    // Getter Functions

    std::string GetFileName()                                       { return m_FileName; }
    std::string GetPath()                                           { return m_Path; }
    std::string GetPathFileName()                                   { return m_PathFileName; }
    uint32_t GetHandle()                                            { return m_Handle; }
    uint32_t GetRefCount()                                          { return m_RefCount; }
};

#endif // CRESOURCE_H
